/*
 * The TJS2 interpreter from kirikirij
 */

/* SCE CONFIDENTIAL
 * PlayStation(R)Suite SDK 0.98.2
 * Copyright (C) 2012 Sony Computer Entertainment Inc.
 * All Rights Reserved.
 */

using System;

using Kirikiri.Tjs2;

namespace Sample
{
	public class AppMain
	{
		public class DebugConsoleOutput : ConsoleOutput
        {
            public void ExceptionPrint(string msg)
            {
                Console.Write("Error:");
                Console.WriteLine(msg);
            }

            public void Print(string msg)
            {
                Console.Write("OUT:");
                Console.WriteLine(msg);
            }
        }
		

		public static void Main (string[] args)
		{
			Initialize ();
			Console.ReadLine();
		}

		public static void Initialize ()
		{
			TJS.mStorage = null;
            TJS.Initialize();
            TJS mScriptEngine = new TJS();
            TJS.SetConsoleOutput(new DebugConsoleOutput());
            
            Dispatch2 dsp = mScriptEngine.GetGlobal();
            Variant ret = new Variant();
            mScriptEngine.ExecScript("Debug.message(\"Hello World!\");", ret, dsp, null, 0);
		}
	}
}